# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

pkgname=glad
pkgver=2.0.3
pkgrel=2
pkgdesc='Multi-Language Vulkan/GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specs'
url='https://github.com/Dav1dde/glad'
arch=('any')
license=('MIT')
depends=('python' 'python-jinja' 'python-lxml' 'python-setuptools')
makedepends=('python-build' 'python-installer' 'python-wheel')
checkdepends=('python-pytest')
source=(${url}/archive/refs/tags/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('bf2a97e51b18ad1849165b678f638a9fc2148d31b794d6f5840bc84052c82fd369f4c8e0f6c57898f0b68eea1cd6ec6293ee4d391748f952a3688a34bb5b047c')
b2sums=('1f453ee033348b79cf6e3e48df8e0411de4c0b96e7703b147a2c23a9822305c05478e8855859e375aef7385b4d1d6f21e3e11614a3281edaa1ba5ace91845e18')

prepare() {
  cd ${pkgname}-${pkgver}
  sed 's/import mock/from unittest import mock/' -i tests/test____main__.py
}

build() {
  cd ${pkgname}-${pkgver}
  python -m build --wheel --no-isolation
}

check() {
  cd ${pkgname}-${pkgver}/tests
  PYTHONPATH="${PWD}/../build/lib" pytest
}

package() {
  cd ${pkgname}-${pkgver}
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 README.md -t "$pkgdir"/usr/share/doc/"$pkgname"
  install -Dm 644 LICENSE -t "$pkgdir"/usr/share/licenses/"$pkgname"
}

# vim: ts=2 sw=2 et:
